package com.company;

import javax.swing.*;
import java.util.Scanner;

public class Decoding
{
    public static void main(String[]args)
    {
        if(args!=null&& args.length!=0)
        {
            String OriginalChar=JOptionPane.showInputDialog("Enter the code!");
            String []string=new String[101] ;
            StringBuffer EncryptedChar=new StringBuffer(OriginalChar);

            for( int Key=1;Key<=100;Key++ )
            {
                for(int i = 0;i<OriginalChar.length(); i++)
                {
                    char ch;
                    if(OriginalChar.charAt(i) + Key > 126)
                    {
                        ch = (char)(32 + ((OriginalChar.charAt(i) + Key) - 127));
                        EncryptedChar.setCharAt(i,ch);
                    }
                    else
                    {
                        ch =(char) (OriginalChar.charAt(i) + Key);
                        EncryptedChar.setCharAt(i,ch);
                    }
                }
                string[Key-1]="Key="+Key +" \t "+EncryptedChar;
            }
            JOptionPane.showMessageDialog(null,string);
           
        }
        else
        {
            Scanner scannerObject=new Scanner(System.in);
            String OriginalChar=scannerObject.nextLine();
            String EncryptedChar;
            for( int Key=1;Key<=100;Key++ )
            {
                System.out.print("Key"+" = "+ Key+ " \t");
                for(int i = 0;i<OriginalChar.length(); i++)
                {
                    int EncryptedCharInt;
                    if(OriginalChar.charAt(i) + Key > 126)
                    {
                        EncryptedCharInt = 32 + ((OriginalChar.charAt(i) + Key) - 127);
                    }
                    else
                    {
                        EncryptedCharInt = (OriginalChar.charAt(i) + Key);
                    }
                    System.out.print((char)EncryptedCharInt);
                }
                System.out.print("\n");
            }
        }
    }
}
//:mmZ\dxZmx]Zpgy